package com.zzyl.controller.customer;

import com.zzyl.base.ResponseResult;
import com.zzyl.dto.CustomerLoginDto;
import com.zzyl.dto.MemberDto;
import com.zzyl.service.CustomerLoginService;
import com.zzyl.vo.LoginVo;
import com.zzyl.vo.MemberVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;

/**
 * @className: CustomerLoginController
 * @description:
 * @author: InnovatorX
 * @date: 2024/5/29 11:19
 * @Version: 1.0
 */

@Slf4j
@Api(tags = "客户管理")
@RestController
//@RequestMapping("/customer/user")
public class CustomerLoginController extends ResponseResult {

    @Autowired
    private CustomerLoginService customerLoginService;

    /**
     * 处理用户登录请求。
     *
     * @param dto 用户登录时传递的DTO（数据传输对象），包含登录必要的信息，如用户名和密码。
     * @return 返回一个响应结果，其中包含登录状态和登录成功后的用户信息。
     */
//    @PostMapping("/login")
    @RequestMapping(value = "/customer/user/login", method = RequestMethod.POST)
    @ApiOperation(value = "用户登录")
    public ResponseResult<LoginVo> insert(@RequestBody CustomerLoginDto dto) {
        LoginVo login = customerLoginService.login(dto);
        return success(login);
    }
}
